package com.qf.controller;

import com.alibaba.fastjson.JSONObject;
import com.qf.model.WeiXinResult;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/pay")
public class PayController extends BaseServlet{


    public String paySuccess(HttpServletRequest request, HttpServletResponse response){
        System.out.println("支付成功啦！！！");
        String result = request.getParameter("result");//josn字符串
        System.out.println(result);
        WeiXinResult ws=  JSONObject.parseObject(result,WeiXinResult.class);
        System.out.println(ws.toString());
       if( ws.getResult().getResult_code().equals("SUCCESS")){
           String orderNum = ws.getResult().getOut_trade_no();
           //update order set ostatus=2 where onum=orderNum
       }



        return "";
    }


}
